def f(x):
    '''x的阶乘'''
    r = 1
    for i in range(x):
        t = i + 1
        r *= t 
    return r

if __name__ == '__main__':
    n = int(input())
    nums = [int(x) for x in input().split(' ')]
    d = {}
    for i, num in enumerate(nums):
        nums[i] = (i + 1) * num 
    for num in nums:
        if num not in d:
            d[num] = 0
        d[num] += 1

    result = 0
    for key in d:
        result += f(d[key]) // 2
    # print(d)
    print(result)
